from unittest.mock import mock_open, MagicMock  
import your_script  # 假设你的脚本叫your_script.py  
  
def test_script_with_mock():  
    # 创建一个mock对象来模拟open函数  
    mock_file = mock_open(read_data=b'mock mp4 data')  
      
    # 使用MagicMock来模拟你的脚本中可能用到的其他功能  
    mock_other_stuff = MagicMock()  
      
    # 将mock对象应用到你的脚本中  
    with mock.patch('__main__.open', mock_file):  
        with mock.patch('your_script.some_other_function', mock_other_stuff):  
            # 调用你的脚本函数进行测试  
            your_script.process_mp4()  
              
            # 验证mock对象的行为  
            mock_file.assert_called_once_with('path/to/your/mp4file.mp4', 'rb')  
            mock_other_stuff.assert_called_once()
        
test_script_with_mock()